#define _CRT_SECURE_NO_WARNINGS 1
#include<bits/stdc++.h>
using namespace std;
//http://oj33.cn/contest.php?cid=1075
int x1[8] = {-2,-2,-1,-1,1,1,2,2};
int y11[8] = {1,-1,2,-2,2,-2,1,-1};
int steps=1;
int sum = 0;
bool used[6][6];
void dfs(int x,int y)
{	for (int i = 0; i < 8 ;i++)
	{
		if (!used[x + x1[i]][y + y11[i]]&&x + x1[i] <= 4&& x + x1[i] >= 0 && y + y11[i] >= 0 && y + y11[i] <= 4)
		{
			used[x + x1[i]][y + y11[i]] =1;
			steps++;
			if (steps == 25)
				sum++;
			else
				dfs(x + x1[i], y + y11[i]);
			steps--;
			used[x + x1[i]][y + y11[i]] = 0;
		}
	}

}
int main()
{
	used[0][0] = 1;
	dfs(0, 0);
	cout << sum << endl;
	return 0;
}